// import 'dart:ffi';
import '../../network/http_entity.dart';

class VideoCircleEntity {
  final int? videoCircleId;
  final int? videoId;
  final String? videoCircleName;
  final String? videoCircleDesc;
  final String? videoCircleImage;
  final int? videoJoinCount;
  final String? createTime;
  final int? createBy;
  final int? state;
  final String? updateTime;
  VideoCircleEntity({
    required this.videoCircleId,
    required this.videoId,
    required this.videoCircleName,
    required this.videoCircleDesc,
    required this.videoCircleImage,
    required this.videoJoinCount,
    required this.createTime,
    required this.createBy,
    required this.state,
    required this.updateTime,

  });

  factory VideoCircleEntity.fromJson(Map<String, dynamic> json) {
    return VideoCircleEntity(
        videoCircleId: json['videoCircleId'],
        videoId: json['videoId'],
        videoCircleName: json['videoCircleName'],
        videoCircleDesc: json['videoCircleDesc'],
        videoCircleImage: json['videoCircleImage'],
        videoJoinCount: json['videoJoinCount'],
        createTime: json['createTime'],
        createBy: int.parse(json['createBy']),
        state: json['state'],
        updateTime: json['updateTime'],

    );
  }

  Map<String, dynamic> toJson() {
    return {
      'videoCircleId': videoCircleId,
      'videoId': videoId,
      'videoCircleName': videoCircleName,
      'videoCircleDesc': videoCircleDesc,
      'videoCircleImage': videoCircleImage,
      'videoJoinCount': videoJoinCount,
      'createTime': createTime,
      'createBy': createBy,
      'state': state,
      'updateTime': updateTime
    };
  }
}

class VideoCircleEntityList {
  final List<VideoCircleEntity> videoCircleEntityList;
  final int? pageCurrent;
  final int? pageSize;
  final int? total;
  final bool? hasNext;
  final int? pages;

  VideoCircleEntityList({
    required this.videoCircleEntityList,
    this.pageCurrent,
    this.pageSize,
    this.total,
    this.hasNext,
    this.pages,
  });
  // 'videoId': videoId,
  // 'videoCircleName': videoCircleName,
  // 'videoCircleDesc': videoCircleDesc,
  // 'videoCircleImage': videoCircleImage,
  // 'videoJoinCount': videoJoinCount,
  // 'createTime': createTime,
  // 'create_by': create_by,
  // 'state': state,
  // 'updateTime': updateTime
  factory VideoCircleEntityList.fromJson(List<dynamic> json, dynamic result) {
    HttpEntity httpEntity = result;
    List<VideoCircleEntity> imageTexts = json.map<VideoCircleEntity>((item) {
      VideoCircleEntity mediaCommentEntity = VideoCircleEntity(
          videoCircleId: item['videoCircleId'],
          videoId: item['videoId'],
          videoCircleName: item['videoCircleName'],
          videoCircleDesc: item['videoCircleDesc'],
          videoCircleImage: item['videoCircleImage'],
          createTime: item['createTime'],
          videoJoinCount: item['videoJoinCount'],
          createBy: item['create_by'],
          state: item['state'],
          updateTime: item['updateTime']
        // 其他属性...
      );
      return mediaCommentEntity;
    }).toList();

    return VideoCircleEntityList(
      videoCircleEntityList: imageTexts,
      pageCurrent: httpEntity.oriData['pageCurrent'],
      pageSize: httpEntity.oriData['pageSize'],
      total: httpEntity.oriData['total'],
      hasNext: httpEntity.oriData['hasNext'],
      pages: httpEntity.oriData['pages'],
      // 其他属性...
    );
  }

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    if (videoCircleEntityList != null) {
      map['mediaCommentEntityList'] = videoCircleEntityList?.map((v) => v.toJson()).toList();
    }
    map['pageCurrent'] = pageCurrent;
    map['pageSize'] = pageSize;
    map['total'] = total;
    map['hasNext'] = hasNext;
    map['pages'] = pages;
    return map;
  }
}
